package com.warm.middle.schedule;

import com.warm.middle.schedule.quartz.dynamic.JobUtil;
import com.warm.middle.schedule.quartz.dynamic.TestTask;
import org.quartz.SchedulerException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Date: 2019/12/3 17:07
 * @Author: LChuang
 * @Description:
 */
@RestController
@RequestMapping("/task")
public class TaskController {

    @RequestMapping("/start")
    public void start() throws Exception {
        JobUtil.getInstance().addJob(TestTask.class, "testTask", "testTaskGroup", "0/5 * * * * ?");
    }

    @RequestMapping("/stop")
    public void stop() throws SchedulerException {
        JobUtil.getInstance().pauseJob("testTask", "testTaskGroup");
    }
}
